﻿using System;
using System.Text;

namespace GPS.GPSLanguage
{
    public enum GGAQualityType { Invalid, GPS, DGPS, PPS, Real_Time_Kinematic, Float_RTK, estimated, Manual_input, Simulation, Unknown };
    class GGAQualityToken
    {
        internal static void ParseLanguage(GPSData gpsData, System.Collections.Queue q)
        {
            String qualityToken = (string)q.Dequeue();
            GGAQualityType val = GGAQualityType.Unknown;
            try
            {
                if (qualityToken.Length > 0)
                    val = (GGAQualityType)int.Parse(qualityToken);                    
            }
            catch
            {
                val = GGAQualityType.Unknown;
            }
            gpsData.SetQualityToken(val);

            
            switch (gpsData.MessageType)
            {
                case MessageType.GPGGA:
                    SatelliteCountToken.ParseLanguage(gpsData, q);
                    break;
                default:
                    throw new InvalidLanguageException("How did you get here?");
            }
        }
    }
}
